package com.ymatou.iapi.idcardmng.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.common.lang.CipherUtil;
import com.ymatou.iapi.idcardmng.parameter.SubmitIdCardInfoBean;
import com.ymatou.iapi.idcardmng.service.SubmitIdCardInfoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.database.model.YmtIdCardInfo;
import com.ymttest.database.sqlwapper.YmtIdCardInfoWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
/**
*上传身份证信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SubmitIdCardInfo {
	private static SubmitIdCardInfoBean submitidcardinfoBean;
	private static SubmitIdCardInfoCall submitidcardinfoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("上传身份证信息");
	}

	@Before
	public void caseUp() {
		submitidcardinfoBean = new SubmitIdCardInfoBean();
		submitidcardinfoCall = new SubmitIdCardInfoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(submitidcardinfoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	public static SubmitIdCardInfoBean callSubmitIdCardInfo() throws Exception {

		submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));

		submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
				.getData("BuyUserId")));
		/*		submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
						.getData("SellerId2")));*/
		submitidcardinfoBean.setCardNumber(TestDataManager.getCardId(20, 10));

		submitidcardinfoBean.setCardType(1);
		submitidcardinfoBean.setHasPic(true);
		submitidcardinfoBean.setMobile("136" + TestDataManager.getRandomNum(8));
		submitidcardinfoBean.setName(TestDataManager.getChineseName());
		submitidcardinfoBean.setOperater("autotest");
		submitidcardinfoBean
				.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
		submitidcardinfoBean
				.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
		submitidcardinfoBean
				.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

		submitidcardinfoBean
				.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

		submitidcardinfoBean.setCheckIdCardStatus(200);

		submitidcardinfoCall.setData(false, submitidcardinfoBean);
		submitidcardinfoCall.callService();

		Thread.sleep(2000);

		return submitidcardinfoBean;

	}

	private void verifyDb() throws Exception {

		long buyerId = submitidcardinfoBean.getBuyerId();
		YmtIdCardInfoWapper ymtIdCard = new YmtIdCardInfoWapper();
		String oldKey = "1234567890123456";
		String newKey = "123456789";

		YmtIdCardInfo ymtIdCardInfo = ymtIdCard.selectByBuyerId(buyerId);

		Logger.comment("校验身份证信息表ymt_idcardinfo");

		Logger.verifyEquals((int) buyerId, ymtIdCardInfo.getBuyerId(),
				"校验buyerid");

		Logger.verifyEquals(submitidcardinfoBean.getName(),
				ymtIdCardInfo.getName(), "校验name");

		Logger.verifyEquals(submitidcardinfoBean.getCardType(),
				ymtIdCardInfo.getCardType(), "校验CardType");

		Logger.verifyEquals(0, ymtIdCardInfo.getStatus(), "校验Status");
		Logger.verifyEquals(submitidcardinfoBean.isHasPic(),
				ymtIdCardInfo.getHasPic(), "校验HasPic");
		Logger.verifyEquals(submitidcardinfoBean.getOperater(),
				ymtIdCardInfo.getOperater(), "校验Operater");
		Logger.verifyEquals(0, ymtIdCardInfo.getRejectReason(),
				"校验RejectReason");
		Logger.verifyEquals(0, ymtIdCardInfo.getIsDelete(), "校验IsDelete");

		Logger.verifyEquals(CipherUtil.encryptAES(oldKey,
				submitidcardinfoBean.getCardNumber()), ymtIdCardInfo
				.getIDCard(), "校验IDCard");
		Logger.verifyEquals(
				ymtIdCardInfo.getPhone() != null ? CipherUtil.encryptAES(
						oldKey, submitidcardinfoBean.getMobile()) : null,
				ymtIdCardInfo.getPhone(), "校验phone");
		Logger.verifyEquals(String.format(
				"%s;%s",
				CipherUtil.encryptAES(oldKey,
						submitidcardinfoBean.getMarkRightSide()),
				submitidcardinfoBean.getRightSide() == null ? "null"
						: CipherUtil.encryptAES(oldKey,
								submitidcardinfoBean.getRightSide())),
				ymtIdCardInfo.getRightSide(), "校验RightSide");
		Logger.verifyEquals(String.format(
				"%s;%s",
				CipherUtil.encryptAES(oldKey,
						submitidcardinfoBean.getMarkReverseSide()),
				submitidcardinfoBean.getReverseSide() == null ? "null"
						: CipherUtil.encryptAES(oldKey,
								submitidcardinfoBean.getReverseSide())),
				ymtIdCardInfo.getReverseSide(), "校验ReverseSide");
		Logger.verifyEquals(submitidcardinfoBean.getCheckIdCardStatus(),
				ymtIdCardInfo.getCheckIdCardStatus(), "校验CheckIdCardStatus");
		
		if (ymtIdCardInfo.getPhone() != null) {
			
			String plainText = CipherUtil.decryptAES(oldKey, ymtIdCardInfo.getPhone());
			
			Logger.verifyEquals(CipherUtil.encryptAES(newKey, plainText),
					ymtIdCardInfo.getMobile(), "校验Mobile");
			Logger.verifyEquals(plainText,
					ymtIdCardInfo.getTempPhone(), "校验TempPhone");
			
		} else {
			
			Logger.verifyEquals(
					submitidcardinfoBean.getMobile() != null ? CipherUtil
							.encryptAES(newKey,
									submitidcardinfoBean.getMobile())
							: ymtIdCardInfo.getMobile(), ymtIdCardInfo
							.getMobile(), "校验Mobile");
			
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_001() {
		Logger.start(true, "上传身份证信息和图片成功,发送mq消息通知交易,贝海");
		try {
			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));

			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");

			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_002() {
		Logger.start(true, "用户id,与姓名在本地库存在,提交更新身份证号码成功,发送mq消息通知交易,贝海");
		try {

			long buyerId = Long.valueOf(EnvSetup.getData("SellerId2"));

			YmtIdCardInfoWapper ymtIdCard = new YmtIdCardInfoWapper();;

			YmtIdCardInfo ymtIdCardInfo = ymtIdCard.selectByBuyerId(buyerId);

			String name = ymtIdCardInfo.getName();

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(buyerId);
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(name);
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");
			
			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_003() {
		Logger.start(true, "买家Id为null");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			/*		submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
							.getData("SellerId2")));*/
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("400", submitidcardinfoCall.getString("Code"),
					"验证Code");

			Logger.verifyEquals("100", submitidcardinfoCall.getString("BCode"),
					"验证BCode");

			Logger.verifyEquals("buyerId:买家Id不能为空",
					submitidcardinfoCall.getString("Msg"), "验证Msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_004() {
		Logger.start(true, "身份证正面 rightSide 字符串 为null");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			/*	submitidcardinfoBean
						.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");*/
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");

			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_005() {
		Logger.start(true, "身份证反面 reverseSide 字符串 为null");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			/*	submitidcardinfoBean
						.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");*/
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");

			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_006() {
		Logger.start(true, "身份证图片地址在图片服务器不存在");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/1.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/1.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/2.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/2.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");

			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_007() {
		Logger.start(true, "证件号为null");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			/*			submitidcardinfoBean
								.setCardNumber(TestDataManager.getCardId(20, 10));*/
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("400", submitidcardinfoCall.getString("Code"),
					"验证Code");
			Logger.verifyEquals("100", submitidcardinfoCall.getString("BCode"),
					"验证BCode");

			Logger.verifyEquals("cardNumber:证件号不能为空",
					submitidcardinfoCall.getString("Msg"), "验证Msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_008() {
		Logger.start(true, "姓名name为null");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			//submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("400", submitidcardinfoCall.getString("Code"),
					"验证Code");
			Logger.verifyEquals("100", submitidcardinfoCall.getString("BCode"),
					"验证BCode");

			Logger.verifyEquals("name:名称不能为空",
					submitidcardinfoCall.getString("Msg"), "验证Msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_009() {
		Logger.start(true, "买家Id为0");
		try {

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(-1L);
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));
			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("400", submitidcardinfoCall.getString("Code"),
					"验证Code");

			Logger.verifyEquals("100", submitidcardinfoCall.getString("BCode"),
					"验证BCode");

			Logger.verifyEquals("buyerId:买家Id必须大于0",
					submitidcardinfoCall.getString("Msg"), "验证Msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_010() {
		Logger.start(true, "上传身份证信息和图片,手机号格式不正确");
		try {
			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));

			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName(TestDataManager.getChineseName());
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");

			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_011() {
		Logger.start(true, "手机号为空");
		try {

			submitidcardinfoBean = callSubmitIdCardInfo();

			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(25008646L);
			submitidcardinfoBean.setName("testUser3");

			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));

			submitidcardinfoBean.setMobile(null);
			submitidcardinfoBean.setOperater("autotest");

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");
			
			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubmitIdCardInfo_012() {
		Logger.start(true, "上传身份证信息包含特殊字符和图片成功,发送mq消息通知交易,贝海");
		try {
			submitidcardinfoBean.setBillCode(TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setBuyerId(Long.valueOf(EnvSetup
					.getData("SellerId2")));
			submitidcardinfoBean.setCardNumber(TestDataManager
					.getCardId(20, 10));

			submitidcardinfoBean.setCardType(1);
			submitidcardinfoBean.setHasPic(true);
			submitidcardinfoBean.setMobile("136"
					+ TestDataManager.getRandomNum(8));
			submitidcardinfoBean.setName("伊利特拜尔•阿布都艾尼");
			submitidcardinfoBean.setOperater("autotest");
			submitidcardinfoBean
					.setReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAEA_gAAB47-RPlbM047_586_367_o.jpg");
			submitidcardinfoBean
					.setRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7eAKwtqAABQMz0rvxE036_5_3_o.jpg");
			submitidcardinfoBean
					.setMarkRightSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd7iAJ2HAAAB3SVFakLc798_5_3_o.JPG");

			submitidcardinfoBean
					.setMarkReverseSide("http://file.iapi.ymatou.com/G01/M00/3A/76/rBBlD1ncd-GAa4tdAACybz9T5zY172_586_367_o.JPG");

			submitidcardinfoBean.setCheckIdCardStatus(200);

			submitidcardinfoCall.setData(submitidcardinfoBean);
			submitidcardinfoCall.callService();

			Logger.verifyEquals("200", submitidcardinfoCall.getString("Code"),
					"验证Code");

			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println(CipherUtil.decryptAES("123456789", "F9E49A3599E504F700ED2A2F750488D6"));
	}
}